package app.controllers;

import app.dao.AnimalDao;
import app.models.Animal;
import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;

@Resource
public class AnimalController {
	
	private Result result;
	private AnimalDao animalDao;
	
	public AnimalController(Result result, AnimalDao zebuDao){
		this.result = result;
		this.animalDao = zebuDao;
	}
	
	@Get
	@Path("animal/consulta")
	public Animal consultar(Animal entity){
		try{
			return animalDao.loadByNome(entity.getNome());
		}catch (Exception e) {
			result.include("msg", e.getMessage());
		}
		return null;
	}
	
	public void criar (Animal animal){
//		AnimalDao dao = new AnimalDao();
//		dao.salva(animal);
	}

}
